package com.example.pceb.mapper;

import com.example.pceb.entity.ProjectPhaseMidterm;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;

@Mapper
public interface ProjectPhaseMidtermMapper {
    
    @Insert("INSERT INTO project_phase_midterm (project_id, status, responsible_person, start_time, description) " +
            "VALUES (#{projectId}, #{status}, #{responsiblePerson}, #{startTime}, #{description})")
    int insert(ProjectPhaseMidterm phase);
    
    @Select("SELECT * FROM project_phase_midterm WHERE project_id = #{projectId}")
    ProjectPhaseMidterm selectByProjectId(Long projectId);
    
    @Update("UPDATE project_phase_midterm SET status = #{status}, responsible_person = #{responsiblePerson}, start_time = #{startTime}, description = #{description} WHERE project_id = #{projectId}")
    int updateByProjectId(ProjectPhaseMidterm phase);
    
    @Select("SELECT * FROM project_phase_midterm")
    List<ProjectPhaseMidterm> selectAll();
} 